# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Stijn Segers <francesco dot borromini at gmail dot com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - define WITH_NEON and ARM_FP_ABI to fix retard developer assumptions

pkgname=freerdp
epoch=1
pkgver=1.2.0_beta1+android9
_pkgver=${pkgver/_/-}
_pkgver=${_pkgver/+/-}
pkgrel=1
pkgdesc="Free RDP client"
arch=('i686' 'x86_64')
url="http://freerdp.sourceforge.net"
license=('GPL')
depends=('openssl' 'libxcursor' 'libcups' 'alsa-lib' 'libxext' 'libxdamage'
	 'ffmpeg' 'libxkbfile' 'libxinerama' 'libxv' 'libpulse' 'libxkbfile'
	 'libxrender' 'libxfixes' 'gst-plugins-base-libs')
makedepends=('krb5' 'cmake' 'damageproto' 'fixesproto' 'renderproto'
	     'xmlto' 'docbook-xsl' 'git')
conflicts=('freerdp-git')
#source=(FreeRDP-${_pkgver}::git://github.com/FreeRDP/FreeRDP.git#commit=ff6dbb049ce066f6fca5708f81fd33f97086bc0e
source=($pkgname-$pkgver.tar.gz::https://github.com/FreeRDP/FreeRDP/archive/${pkgver/_/-}.tar.gz
	https://github.com/FreeRDP/FreeRDP/commit/1b663ceffe51008af7ae9749e5b7999b2f7d6698.patch
	stuck_winkey.patch)
md5sums=('a4a0a4f6e69c871aeab0600091ca6118'
         '83da0f44c0e1a51707fad5ed06fd7b06'
         'd29f028e61967f091f021d24005dbee2')

prepare() {
  cd $srcdir/FreeRDP-${_pkgver}
  patch -p1 <$srcdir/stuck_winkey.patch
  patch -p1 <$srcdir/1b663ceffe51008af7ae9749e5b7999b2f7d6698.patch
}

build() {
  cd $srcdir/FreeRDP-${_pkgver}

  [[ $CARCH == "arm" ]] && ABI="soft"
  [[ $CARCH == "armv6h" || $CARCH == "armv7h" ]] && ABI="hard"

  cmake \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DWITH_PULSE=ON \
	-DWITH_CUPS=ON \
	-DWITH_CHANNELS=ON \
	-DWITH_CLIENT_CHANNELS=ON \
	-DWITH_SERVER_CHANNELS=ON \
	-DWITH_NEON=OFF \
	-DARM_FP_ABI=${ABI} \
	.
  make
}

package() {
  cd $srcdir/FreeRDP-${_pkgver}
  make DESTDIR="${pkgdir}" install
}
